package structure.adapter;

/**
 * 适配器需要  自身的作用就是播放MP3 是MP3播放不是那么就调用适配器去播放
 */
public class Adapter implements Player {

	private Player player;

	@Override
	public void play(String type, String name) {
		if(type.equalsIgnoreCase("mp3")){
			player.play("", name);
		}else if(type.equalsIgnoreCase("mp4")){
			player.play("", name);
		}	
	}

	public Adapter(String type) {
		if(type.equalsIgnoreCase("mp3") ){
			player = new Mp3Player();
	    } else if (type.equalsIgnoreCase("mp4")){
			player = new Mp4Player();
	    }
	}
	
}
